package com.wwy.config;

import org.springframework.amqp.core.*;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

/**
 * @author 王伟羽
 * @date 2024/3/14 10:49
 */

@SpringBootConfiguration
public class RouterConfiguration {


        @Bean
        public DirectExchange  getRouterExchange(){
            return new DirectExchange("router_exchange_one");
        }

        @Bean
        public Queue getRouterQueueOne(){
            return new Queue("router_queue_one");
        }

        @Bean
        public Queue getRouterQueueTwo(){
            return new Queue("router_queue_two");
        }

        @Bean
        public Queue getRouterQueueThree(){
            return new Queue("router_queue_three");
        }

        @Bean
        public Binding getRouterBindingOne(){
            return BindingBuilder.bind(getRouterQueueOne()).to(getRouterExchange()).with("aaa");
        }

        @Bean
        public Binding getRouterBindingThree(){
            return BindingBuilder.bind(getRouterQueueThree()).to(getRouterExchange()).with("bbb");
        }


        @Bean
        public Binding getRouterBindingTwo(){
            return BindingBuilder.bind(getRouterQueueTwo()).to(getRouterExchange()).with("ccc");
        }


}
